package com.app.repository.impl;

import com.app.model.main.Agreement;
import com.app.repository.interfaces.AgreementMapper;
import com.app.support.dao.MybatisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * Created by Lichaojie on 2017/3/12. It's a beautiful day.
 */
@Repository
public class AgreementMapperImpl implements AgreementMapper {

    @Autowired
    private MybatisDao mybatisDao;

    @Override
    public int deleteByPrimaryKey(Long id){
        return mybatisDao.delete("com.app.dao.main.AgreementMapper",".deleteByPrimaryKey",id);
    }

    @Override
    public int insert(Agreement record){
        return mybatisDao.insert("com.app.dao.main.AgreementMapper",".insert",record);
    }

    @Override
    public int insertSelective(Agreement record){
        return mybatisDao.insert("com.app.dao.main.AgreementMapper",".insertSelective",record);
    }

    @Override
    public Agreement selectByPrimaryKey(Long id){
        return mybatisDao.get("com.app.dao.main.AgreementMapper",".selectByPrimaryKey",id);
    }

    @Override
    public int updateByPrimaryKeySelective(Agreement record){
        return mybatisDao.update("com.app.dao.main.AgreementMapper",".updateByPrimaryKetSelective",record);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(Agreement record){
        return mybatisDao.update("com.app.dao.main.AgreementMapper",".updateByPrimaryKeyWithBLOBs",record);
    }

    @Override
    public int updateByPrimaryKey(Agreement record){
        return mybatisDao.update("com.app.dao.main.AgreementMapper",".updateByPrimaryKey",record);
    }

    @Override
    public long getMaxId(){
        return mybatisDao.count("com.app.dao.main.AgreementMapper",".getMaxId",null);
    }
}
